package com.kinsin.kinsinlogsystem;

import android.os.SystemClock;
import android.view.View;


/**
 *  防止按钮重复点击事件
 */
public abstract class FilterClickListener implements View.OnClickListener {

    public static final int MIN_CLICK_DELAY_TIME = 200;
    private long lastClickTime = 0;

    @Override
    public void onClick(View v) {
        long currentTime = SystemClock.elapsedRealtime();
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime;
            onFilterClick(v);
        }
    }

    protected abstract void onFilterClick(View view);
}
